package edu.sctu.jarime.may.day20150510;

/**
 * Created by user19 on 2015/5/10.
 */
public class TextTwo {
    TextOne[] textOnes;


    public void information(TextOne[] textOnes) {

        this.textOnes = textOnes;
    }

    public void judge() {

//方法一
        for (int i = 0; i < textOnes.length; i++) {
            if (20 < textOnes[i].getage()) {
                System.out.print("已成年");
                System.out.println("\t" + textOnes[i].getname() + "\t" + textOnes[i].getsex());


            } else {
                System.out.print("未成年");
                System.out.println("\t"+textOnes[i].getname() + "\t" + textOnes[i].getsex());

            }
        }
//方法二
        for (TextOne textOne : textOnes) {
            if (20 < textOne.getage()) {
                System.out.print("已成年");
                System.out.println("\t" + textOne.getname() + "\t" + textOne.getsex());


            } else {
                System.out.print("未成年");
                System.out.println("\t"+textOne.getname() + "\t" + textOne.getsex());

            }
        }


    }
}
